package com.lyf.design.practice.theory.create.builder;

/**
 * 参考源码（Spring-Jdbc)：{@link}
 * org.springframework.boot.jdbc.DataSourceBuilder
 *
 * @author LYF
 * @date 2022/6/19
 */
public class DataSourceBuilder {
    DataSource dataSource;

    /**
     * {@link Exception}
     */
    public DataSourceBuilder() {
    }

    public DataSourceBuilder(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    DataSourceBuilder buildBasic(String name){
        dataSource.setName(name);
        return this;
    }
    DataSourceBuilder buildConInfo(String className,String url,String username,String password){
        dataSource.setClassName(className);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
        return this;
    }
    DataSourceBuilder type(String type){
        dataSource.setType(type);
        return this;
    }
    DataSource build(){
        return dataSource;
    }





}
